#include "Resource.h"

namespace Resource
{
	bool init()
	{
		//
	}
	
	void free()
	{
		//
	}
	
	File* loadFile(const char *name)
	{
		ASSERT(name);
		
		FILE *input = NULL;
		
		if ((input = fopen(name, "rb")) == NULL)
		{
			LOG_ERROR("Opening file '%s'\n", name);
			return NULL;
		}
		
		fseek(input, 0, SEEK_END);
		uint32_t size = (uint32_t)ftell(input);
		rewind(input);
		
		File *file = new File(size);
		ASSERT(file);
		
		fread(file->data, 1, file->size, input);
		fclose(input);
		
		return file;
	}
	
	void freeFile(File *file)
	{
		delete file;
	}
}
